import { defineStore } from 'pinia'
import { ref, watch } from 'vue'
import { useRoute } from 'vue-router'

export const useLayoutStore = defineStore('layout', () => {
  const isHome = ref(false)

  // 设置是否为首页
  const setIsHome = (value) => {
    isHome.value = value
  }

  // 根据路由路径判断是否为首页
  const updateIsHomeByRoute = (routePath) => {
    isHome.value = routePath === '/home' || routePath === '/'
  }

  return {
    isHome,
    setIsHome,
    updateIsHomeByRoute
  }
})